import { _mid, _dis, _polar, _atan, _k, _sin, _o } from '../math/index.js'
import { eachNext } from '../utils/index.js'
export const sinPoints = (points, options) => {
    let {
        k = 0, a = 0, w = 1
    } = options //  num = 36, r = 100,
    let ps = []
    let o = _o(points),
        r = _dis(o, points[0]),
        num = _k(r / 3, 0)
    eachNext(points, (t, index, next) => {
        let m = _mid(t, next)
        a = _atan(o, m)
        ps.push(...Array.from({
            length: num,
        },
            (t, i) => [
                _k((i * 360) / num + o[0] - 180),
                _k(r * _sin(w * ((i * 360) / num - 180) - a) + o[1] - k),
            ]
        ))
    })
    return ps
}